﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace DomainInfoLib
{
    /// <summary>
    /// API连接池
    /// </summary>
    public class APIPool : IEnumerable
    {
        static IWebAPI WebAPI = new WanWangAPI();

        static IWebAPI WebAPI1 = new SanwaysAPI();

        static IWebAPI WebAPI2 = new CnolnicAPI();

        static IWebAPI WebAPI3 = new WhomsyAPI();

        static IWebAPI WebAPI4 = new Whoisxmlapi();

        static IWebAPI WebAPI5 = new DynadotAPI();

        static List<IWebAPI> ApiList = new List<IWebAPI>();

        static APIPool()
        {
            SetApiList();


        }

        private static void SetApiList()
        {
            ApiList.Add(WebAPI);
            ApiList.Add(WebAPI1);
            ApiList.Add(WebAPI2);
            //ApiList.Add(WebAPI3);
            //ApiList.Add(WebAPI4);
            //ApiList.Add(WebAPI5);
        }



        public IWebAPI this[int index]
        {
            get { return ApiList[index]; }
            
        }

        public int Count 
        { 
            get { return ApiList.Count; } 
        }

        public IEnumerator GetEnumerator()
        {
            return ApiList.GetEnumerator();
        }
    }
}
